Computer program product for domained incremental changes storage and retrieval

ABSTRACT

A computer program product comprising at least one controller to enable a processor to perform incremental changes storage and retrieval. The at least one controller comprises an incremental storage adaptor for enabling the processor to store a change associated with a base file, rather than modifying the base file by the change and storing the result as a new file. An incremental retrieval adaptor is included for enabling the processor to merge the change with the base file thereby forming a logical new file. The incremental retrieval adaptor can perform the merging in response to a call from an application running on the processor or another processor, and the incremental retrieval adaptor then provides or otherwise makes the logical new file available to the application.

CROSS-REFERENCE TO RELATED APPLICATION

The following is a related, commonly owned, co-pending application:

System and Method for Domained Incremental Changes

Storage and retrieval, allowed U.S. patent application Ser. No.08/486,485 now U.S. Pat. No. 5,680,621.

DESCRIPTION

1. Technical Field

The present invention relates to the field of data processing, and moreparticularly, to a computer program product for making a multi-stepprocessing pattern more efficient.

2. Background Art

Various code generation tools read a file (text or binary), and based onthe contents of the file, they generate a new file. In many cases thenew file is mostly the original file, with some changes. This new fileis then used by another software processor, such as a compiler. Thisprocess is not very efficient for the following reasons: (1) the codegeneration tool has to read the original file and write the new file,and (2) several passes through file a re sometimes required during thegeneration, each time adding more information to the generated file, andeach time, the whole (new) file is written to secondary memory, such asa disk memory.

Consider the pattern of the following scenario shown in FIG. 1. A usercreates and stores a data file 102 called ORIGINAL. An application 104,or some type of a code generator utility, called CODEGEN, readsORIGINAL, processes it, then writes a new file 106, called GENERATED.GENERATED is used by another utility 108, called COMPILER. Manypre-processors operate in this manner.

More specifically, consider a tool, called CODEGEN, that reads a C++file, ORIGINAL, and generates a new file, GENERATED, in which everyclass defined in ORIGINAL is changed to inherit from some base class.For example, if the ORIGINAL file contains the following at line 98:

class A . . . !;

The generated file will contain:

class A : public Base . . . !;

In other words, the information ": public Base" is inserted into line 98by the code generation tool, CODEGEN.

This process requires that the entire file be both read from, andwritten to secondary memory every time a file is (re)generated. Thereading of the original file and the writing of the generated file is adrain on system resources, and requires a great deal of input/output(I/O) bandwidth. What is desired is a technique for making incrementalchanges to files that minimizes use of a system's I/O resources, improveresponse time and usability.

Disclosure of Invention

The present invention is directed to a computer program product forstoring and accessing data via a controller having adapters so that theoverall process takes less time. The time saved is due to the reducedamount of I/O time.

This technique saves time by eliminating the need to write new generatedfiles to disk. Rather than doing that, just the changes are written andmaintained in association with the original (base) file. An entire newfile is not written to disk. Two adapters are described. One creates andmaintains the changes, and the other adaptor is used to access a"logical new file," which is the base file modified by the changes.

The controller comprises an incremental storage adaptor for enabling acomputer to store a change associated with a base file, rather thanmodifying the base file by the change and storing the result as a newfile, and an incremental retrieval adaptor for enabling the processor tomerge the change with the base file thereby forming a logical new file.The incremental retrieval adaptor performs the merging in response to acall from an application running on a processor, and the incrementalretrieval adaptor then provides or otherwise makes the logical new fileavailable to the application..

In a preferred embodiment of the invention, the changes are stored in adomained incremental change repository. Calls to the ISA and IRA to doI/O pass information identifying the domained incremental changerepository and the base file. The incremental storage adaptor'interfaceswith the domained incremental change repository to store changes. Theincremental retrieval adaptor interfaces with the domained incrementalchange repository in a process to retrieve records from the logical newfile. (These records are retrieved from either the base file or from adomain incremental changes repository.)

In a further embodiment the system has a plurality of domainedincremental change repositories, and each base file can have changes inone or more domained incremental change repositories.

The foregoing and other features and advantages of the invention will beapparent from the following more particular description of preferredembodiments of the invention, as illustrated in the accompanyingdrawings.

BRIEF DESCRIPTION OF DRAWING

The invention will be better understood if reference is made to theaccompanying drawings.

FIG. 1 shows a representative example of a conventional multi-stepprocessing pattern.

FIG. 2 shows a diagram including an incremental storage adaptor (ISA),in accordance with the present invention.

FIG. 3 shows a diagram including an incremental retrieval adaptor (IRA),in accordance with the present invention.

FIG. 4 shows a flow diagram for plural IRAs, in accordance with anotherembodiment of the present invention.

FIG. 5 shows an example of a computer system environment depicting ahardware implementation of the present invention.

In the drawings, like reference numbers indicate identical orfunctionally similar elements. Additionally, the left-most digit of thereference number identifies the drawing in which the reference numberfirst appears.

BEST MODE FOR CARRYING OUT THE INVENTION

1. Nomenclature and Definitions

The detailed descriptions which follow are presented in part in terms ofalgorithms and symbolic representations of operations on data bitswithin a computer memory representing alphanumeric characters or otherinformation. These descriptions and representations are the means usedby those skilled in the data processing arts to most effectively conveythe substance of their work to others skilled in the art.

An algorithm is here, and generally, conceived to be a self-consistentsequence of steps leading to a desired result. These steps are thoserequiring physical manipulations of physical quantities. Usually, thoughnot necessarily, these quantities take the form of electrical ormagnetic signals capable of being stored, transferred, combined,compared, and otherwise manipulated. It proves convenient at times,principally for reasons of common usage, to refer to these signals asbits, values, symbols, characters, display data, terms, numbers, or thelike. It should be borne in mind, however, that all of these and similarterms are to be associated with the appropriate physical quantities andare merely used here as convenient labels applied to these quantities.

Further, the manipulations performed are often referred to in terms,such as comparing or adding, commonly associated with mental operationsperformed by a human operator. No such capability of a human operator isnecessary, or desirable in most cases, in any of the operationsdescribed herein which form part of the present invention; theoperations are machine operations. Useful machines for performing theoperations of the present invention include general purpose digitalcomputers or other similar devices. In all cases the distinction betweenthe method operations in operating a computer and the method ofcomputation itself should be recognized. The present invention relatesto method steps and apparatus for operating a computer in processingelectrical signals to generate other desired physical signals.

The present invention also relates to an apparatus for performing theseoperations. This apparatus may be specifically constructed for therequired purposes or it may comprise a general purpose computer asselectively activated or reconfigured by a computer program stored inthe computer. The algorithms presented herein are not inherently relatedto any particular computer or other apparatus. In particular, variousgeneral purpose machines may be used with programs written in accordancewith the teachings herein, or it may prove more convenient to constructmore specialized apparatus to perform the required method steps. Thestructure for a variety of these machines will become apparent from thedescription below.

In the following description, several terms are used frequently, havespecialized meanings in the present context, and are thus defined. Theterms "application," "application program," and "program" are usedinterchangeably herein to refer to any computer program run inconjunction with the present invention. The terms "disk," "disk drive,"and "secondary memory" are used interchangeably to refer permanent-typememory storage requiring I/O operations, rather that main memory that isused by a processor for running programs, and the like. The terms"ORIGINAL" file and "base" file are used interchangeably. CODEGEN andCOMPILER are terms used to represent application programs.

2. Overview of the Invention

The present invention includes an incremental Storage Adapter, (ISA;described below), to store changes in some association with a base file.The present invention also includes an incremental retrieval Adapter,(IRA; described below) to retrieve records to form a "logical new file"by merging the base file with stored changes. Thus, rather thangenerating and saving a new file, the changes are machine readablerecords stored separately, but in association with the base file thatare combined to form the logical new file in a manner transparent to anapplication that uses the new logical file.

Referring again to the above example, according to the present inventionthe string "R 98 class A : public Base"can be stored as a change, where"R 98" identifies that new line 98 needs to be replaced, and the stringthat follows (i.e., "class A : public Base") is the new contents of line98. Change information can contain information for replacing, insertingand deleting lines, bytes, records, and the like.

Some pre-processors (CODEGENs) have to generate and regenerate codeseveral times before the next process is invoked, because as more filesare processed, new information needs to be added to files that havealready been generated.

In order to compare the efficiency of the present invention toconventional techniques, consider the following analysis, where:##EQU1##

Then doing the CODEGEN process in th e conventional way would cost upto:

Cost1=2*D*P

That is because every time a regeneration is performed, the entire basefile must be read from disk, and the GENERATED file must be written todisk.

Taking advantage of the present invention, the process can take aslittle as:

Cost2=1*D

Because only the base file needs to be read, no substantive writing isdone (assuming the writing of the change takes relatively no time withrespect to D, which is the reading or writing time of the entire file).

So the present invention is cheaper than the old method by:

Cost1-Cost2=2*D*P-D=D*(2P-1)

For example, if it takes 10 seconds to read/write a file (D=10seconds),and only one iteration of code generation is necessary (P=1), doing itthe conventional way, CODEGEN would spend 2*10=20 seconds. Using the newmethod according to the present invention, it would only take 10seconds. If, however, three iterations of code generation are required(P=3) by the conventional way, the cost would be 60 seconds, where doingit according to the invention would still take only 10 seconds.

The calculations for these comparative examples are approximationsassuming that changes are small, and GENERATED is about the same size asthe base file. Also, it is assumed that the time it takes to write thechange is negligible. The larger the file, the more negligible this timeis.

The present invention comprises two major adapters, an IncrementalStorage Adapter (ISA) and an Incremental Retrieval Adapter (IRA).Preferably, the ISA and IRA are implemented as processing elements(e.g., controller logic) operating in accordance with software beingexecuted on a processing element of a computer system. A preferredembodiments of the ISA and IRA are described in detail below in the formof pseudo code. The ISA is responsible for storage of changes in anassociated domain and the IRA is responsible for merging a base and thechanges from an associated domain to form a logical new file. Bothcontrollers can be parts of the same physical adapter.

3. Incremental Storage Adapter (ISA)

This controller is used to maintain the change information associatedwith a given base file. FIG. 2 shows a flow diagram for ISA operation.CODEGEN 202 reads base file ORIGINAL 204. changes are passed to an ISA206 that writes the changes to a repository 208, called a domainincremental changes repository (DICR), which is described further below.The ISA maintains this information in an efficient manner for theOperating System (OS; not shown) in which it runs. Every update to thebase file is made through the ISA.

4. Incremental Retrieval Adapter (IRA)

FIG. 3 shows a flow diagram for an IRA operation. An application/process(e.g., COMPILER 302) that requires reading a file makes a function call,or otherwise interfaces with an IRA 304 to read (see Read(record name))a record. The IRA 304 reads or otherwise accesses the base file ORIGINAL204, as well as any associated changes from the DICR 208. The IRAcombines the base file with the changes read form the DICR 208 to createa logical record 306, and forwards the logical record 306 to theCOMPILER 302.

Some applications can interface with both the ISA and the IRA, and thusact as both a the CODEGEN and the COMPILER applications in the aboveexamples. Consider a file editor for example. When an edited file isrelatively large, and the changes the user makes in any editing sessionare relatively small, the editor can be analogized to a CODEGENapplication, where the input file is the base file, and through editing,a logical new file is created by storing changes in accordance with thepresent invention.

The ISA, on OS/2™ for example, may store the change information as anattribute of the extended attributes of the base file, or the extendedattribute may contain the name of the file that contains the changes. Onsystems that do not have extended attributes, the extended attributesmay be emulated by other means available on that system, or by anassociated file.

5. The "Domained" Concept

A single base file can be run through two different code generators.Each produces a new file that is very similar to the old file, but eachproduces a different new file. This example illustrates the fact thatmore than one set of changes may be needed. Each code generator produceschanges that are applicable to its domain. A domain therefore is a namedrepository of changes, which when applied to the base file, produces thetarget file.

Several different CODEGENs can make use of the present invention, eachhaving its own domain name. Additionally, a single base file can havemore that one domain associated with it.

6. Data and Logic 6.1 Data

The following data is needed per file, in addition to standard operatingsystem (OS) information that is maintained for each file such as itsfile name, contents, and the like, as would be apparent to a personskilled in the relevant art.

6.1.1 Domained incremental Change Repository (DICR)

A DICR is a named collection of changes that need to be applied to anassociated base file or set of files for processing of logical newfile(s). (This representation needs to be stored in association with thebase file(s) as described above, i.e., extended attributes or anequivalent linking technique, as would become apparent to a personskilled in the data processing art.)

6.2 Logic

An object of the domained incremental changes storage invention is toopen the door for innovations in the storage and processing of thechanges. Therefore, the ISA and IRA are described in a very high levellogic. There are many ways to actually implement the present invention,as would be apparent to a person skilled in the relevant art.

6.2.1 ISA Logic

It is possible to have the ISA provide only one interface function,namely update, such that whenever an application calls this function,the ISA appends the change information to the DICR whose name is passedas the domain name. Exemplary logic for this shown in Table 1.

                  TABLE 1                                                         ______________________________________                                        Update( fileID, domainName, changeInfo)                                       obtain the current value of the DICR whose name is                                   contained in the argument domainName, for the                                 file identified by the value of argument                                      fileID and put it in variable TEMP. (TEMP                                     contains the set of all changes in the                                        specified domain for the specified file.)                              add the new change (whose information is in                                          changeInfo) to TEMP. (This may involve                                        more complex processing in order to                                           optimize the performance of the IRA, the                                      ISA may store the changes in a more                                           efficient organization than a simple                                          sequential order, e.g., sorted order.)                                 write the value of TEMP as the new value of the                                      DICR whose name is contained in                                               domainName, for the file identified by the                                    value of fileID.                                                       }                                                                             ______________________________________                                    

The above update function can be broken into 3 separate functions: open,update and close, in which case the open function is called to identifythe base file and the domain, followed by a series of calls to theupdate function, followed by a call to the close function. This can beused in a CODEGEN application where, due to the nature of the CODEGENapplication, the changes need to be communicated to the ISA over timeand not all at once. In this case, when the open function is called,which specifies the file name and the domain name, the ISA reads thevalue of the domain, (i.e., the list of changes so far). With eachupdate function call, the list is modified with the new changes added,and when the close function is called the new DICR representing thedomain is written to disk.

6.2.2 IRA Logic The IRA interface can be as extensive as any OS's fileinput interface. For simplicity, and for the sake of demonstrating theconcept, the logic below in Tables 2-4 describes a sequential read of aline of text, and assumes the change information maintained by the ISAis on a line basis, although it could be based on byte/character,record, or any unit.

Table 2 represents an algorithm for the opening of a file (whose namepassed in the field "fileID") and obtaining the set of changes in thedomain (whose name is passed in the field "domainName") associated withthe specified file.

                  TABLE 2                                                         ______________________________________                                        open( fileID, domainName)                                                     obtain the current value of the DICR whose name is                                   contained in the argument domainName, for the                                 file identified by the value of fileID.                                open the file identified by the value of the                                         argument FileID. (File pointer is pointing to                                 the first line in the file.)                                           }                                                                             ______________________________________                                    

Table 3 represents an algorithm to read the next line. This algorithmreturns to the next logical line based on the base file and theinformation in the DICR. The DICR could be passed as a parameter to thefunction, it could be a global parameter, or it could be obtained basedon the FileID.

                  TABLE 3                                                         ______________________________________                                        readLine( fileID)                                                             Determine whether the current line has been                                          replaced and the new contents are in the                                      domain, or a new line has been inserted at                                    this point and the new line is in the domain,                                 or the current line has been deleted and that                                 information is in the domain (this information                                is in the DICR)                                                        if replaced /* replacement is in the domain */                                       {                                                                             read a line from the base file, advancing the                                   file pointer to skip over this line.                                        read and return the line from the domain pool.                                }                                                                      else if inserted /* a new line has been inserted at                                  this point */                                                                 {                                                                             read and return the line from the domain pool                                 }                                                                      else if deleted                                                                      {                                                                             read a line from the base file, advancing the                                   file pointer to skip over this line.                                        return readLine( fileID)                                                      }                                                                      else                                                                                 read a line from the base file and return it.                          }                                                                             ______________________________________                                    

Table 4 is simple the closing of the IRS operation.

                  TABLE 4                                                         ______________________________________                                        close ( fileID)                                                               close the file and the DICR.                                                  }                                                                             ______________________________________                                    

7. DICR Clean-up

When updating the DICR, the ISA can have a rule that is triggered whenthe number of changes, or the type and contents of the changes exceed ormeet some criteria. As a result of this condition, the ISA can "cleanup" the repository by "rolling in" (e.g., merging the base file withchanges) into a whole new base file and deleting, or emptying thedomain.

8. Other uses/examples/applications

The present invention is applicable to many applications in addition tothe code generation utilities, and editors that were mentioned above.Compilers, linkers and multimedia tools may also use it to improveperformance or to save storage space.

8.1 Plural Domain Example

FIG. 4 shows flow diagram for plural IRAs that make changes to a singleORIGINAL base file 400 in two different domains. A first IRA α 402applies changes of a first domain DICR1 404. A second IRA β 406 applieschanges of a second domain DICR2 408. In this example, a firstapplication (APPL1) 410 goes through IRA α 402 to read ORIGINAL 400,specifying domain DICRl 404. IRA α 402 reads the ORIGINAL 400 and thechanges from DICR1 404, combines them into a new record in this domain,and returns it as data to APPL1 410. Similarity, a second application(APPL2) 412 goes through IRA β 406 to read ORIGINAL 400, specifyingdomain DICR2, and the changes from DICR2 408, combines them into a newrecord in the second domain, and returns it as data to APPL2 412.

IRA α and IRA β are both instances of the same IRA code. They arerepresented as separate boxes because in this example each retrievesdata from a different domain.

8.2 Still and Moving Pictures

Touch-ups, performed with a utility such as PHOTOSHOP™, can beimplemented in a more efficient manner in accordance with the presentinvention. Rather than saving a whole new file, it can be morebeneficial to only save touch-ups as changes and keep the originalpicture as a base file as described above.

The present invention is also applicable to digital motion pictures(i.e., video). A digital video can be edited to change a few frames.Rather than saving a whole new video, just the changed frames can besaved as changes, or perhaps just the changes to the specific frames.

8.3 Incremental Compiler Example

An incremental compiler can take advantage of a DICR system in thefollowing way. A compilation of some file produces -an object (.OBJ)file. Later on, the user may change a single function in the module.That function is incrementally compiled, and rather than writing a wholenew .OBJ file, only the change is written to disk. In other words, thechange identifies the fact that bytes x-y (old compiled function) needto be replaced with the certain new bytes (the new compiled function).When the linker is invoked with the appropriate invocation option, itknows to go through the IRA, which merges the base .OBJ file and theincremental compiled changes. In a similar way, the incremental linkercan also use the ISA to just write updates to the already existentexecutable file (.EXE). When the loader is invoked, it can access thedomain containing the changes to the .EXE through the IRA and load thenew .EXE.

9. Hardware Exemplar

An example of a computer system environment depicting a hardwareimplementation of the present is shown in FIG. 5. The computer systemenvironment comprises a computer controller 538, which operates on acomputer platform 502. The computer controller 538 includes one or moreapplication program(s) 530 and an programming system 536, for example.The computer platform 502 includes hardware units 510 including acentral processing unit (CPU) 514, a random access memory (RAM) 512, andan input/output interface 516. The RAM 512 is also called a main memory512. The computer platform 502 also includes microinstruction code 508,an operating system 506, and a database manager 504. Various peripheralcomponents may be connected to the computer platform 502, such as aterminal 520, a data storage device 524, and a printing device 528. Thedata storage device or secondary storage 524 may include hard disks andtape drives. The data storage device 524 represents non-volatilestorage. External databases 534 are stored on the secondary storage 524.The operating system uses virtual memory and manages all memory paging.Users 532 interact with the computer platform 502 and the computercontroller 538 via terminal 520.

The ISA and IRA of the invention can be implemented by an applicationprogram 530 or the programming system 536, as would become apparent to aperson skilled in the art and versed in the computer programminglanguage C, C++, or the like. In an example embodiment, the DICR can bestored in an external database 534. In summary, the invention isplatform and language independent.

10. Conclusion

While various embodiments of the present invention have been describedabove, it should be understood that they have been presented by way ofexample, and not limitation. It will be apparent to persons skilled inthe relevant art that various changes in form and detail can be madetherein without departing from the spirit and scope of the invention.Thus the present invention should not be limited by any of theabove-described exemplary embodiments, but should be defined only inaccordance with the following claims and their equivalents. All citedpatent documents and publications in the above description areincorporated herein by reference.

Having thus described our invention, what we claim as new and desire to secure by Letters Patent is:
 1. A computer program product having a computer-readable medium comprising at least one controller to enable a processor to perform incremental changes storage and retrieval, said at least one controller comprising;incremental storage adaptor means for enabling the processor to store a first change associated with a base file, rather than modifying said base file by said first change and storing said first change as a fiat new file, wherein said first new file is associated with a first application program; said incremental storage adaptor means for enabling the processor to store a second change associated with said base file, rather than modifying the base file by said second change and storing said second change as a second new file, wherein said second new file is associated with a second application program; and incremental retrieval adaptor means for enabling the processor to merge one of said first and second changes stored in one of said first and second new files with said base file thereby forming one of a first and second logical new file; wherein said incremental retrieval adaptor performs said merging in response to a call from application programs running on the processor, wherein said call identifies one of said first new file and said second new file, and said incremental retrieval adaptor means then provides or otherwise makes one of said logical new files available.
 2. The computer program product according to claim 1, wherein said first change and said second change are stored in a domained incremental change repository.
 3. The computer program according to claim 2, wherein said incremental storage adapted means has a plurality of domained incremental change repositories.
 4. The computer program product according to claim 2, wherein said incremental storage adaptor means interfaces with said domained incremental change repository to one of add, delete and roll-back changes therein.
 5. The computer program product according to claim 2, wherein said incremental retrieval adaptor means interfaces with said domained incremental change repository in a process to form a logical new file.
 6. The computer program product according to claim 2, wherein said base file has a default domained incremental change repository.
 7. A computer program product having a computer-readable medium comprising at least one controller to enable a processor to perform incremental changes storage and retrieval, said at least one controller comprising:incremental storage adaptor means for enabling the processor to store a change associated with a base file, rather than modifying the base file by said change and storing the result as a plurality of new files, wherein each of said new files is associated with a particular application program; and incremental retrieval adaptor means for enabling the processor to merge each of said new files with said base file thereby forming a plurality of logical new files; wherein said incremental retrieval adaptor means performs said merging in response to a call from an application running on the processor, wherein said call identifies one of said new files, and said incremental retrieval adaptor then provides or otherwise makes one of said logical new files available to said application.
 8. The computer program product according to claim 7, wherein said first change and said second change is stored in a domained incremental change repository.
 9. The computer program product according to claim 8, wherein said incremental storage adaptor means interfaces with said domained incremental change repository to one of add, delete and roll-back changes therein. 